package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.dto.CategoryDTO;
import com.sky.entity.Category;
import com.sky.result.Result;
import com.sky.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController("userCategoryController")
@RequestMapping("/user/category")
@Api(tags = "C端-分类接口")
@Slf4j
public class CategroyController {

    @Autowired
    private CategoryService categoryService;

    /*
    * C端条件查询数据
    * */
    @ApiOperation("条件分类查询")
    @GetMapping("/list")
    private Result<List<Category>> getCategoryList(Integer type) {
        log.info("查询数据:{}", type);
        Category category = new Category();
        category.setType(type);
        category.setStatus(StatusConstant.ENABLE);
        List<Category> categoryList = categoryService.find(category);
        return Result.success(categoryList);
    }


}
